﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="false" CodeBehind="OrderDetail.aspx.vb" Inherits="ACompany.OrderProcessing.UI.MVCWeb.OrderDetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<h2>Order Detail</h2>

<p>
Order Status: <strong><%=Html.Encode(ViewData.Model.Status.ToString)%></strong>
</p>

<% if (Not ViewData.Model.HaveEnoughStockToProcess) And ViewData.Model.Status = ACompany.OrderProcessing.Model.OrderStatus.placed then %>
<table style="border: thin solid #FF0000">
        <tr>
            <td><font color="red">
            There is not enough stock to fulfill this order.
            </font></td>
        </tr>
</table>
<% end if %>

<ul>
<li>Id: <%=Html.Encode(ViewData.Model.Id.ToString)%></li>
<li>Customer Name: <%=Html.Encode(ViewData.Model.Customer.Name)%></li>
<li>Customer Email: <%=Html.Encode(ViewData.Model.Customer.Email)%></li>
</ul>

Despatch Address
<ul>
    <li><%=Html.Encode(ViewData.Model.DespatchAddress.Street)%></li>
    <li><%=Html.Encode(ViewData.Model.DespatchAddress.City)%></li>
    <li><%=Html.Encode(ViewData.Model.DespatchAddress.County)%></li>
    <li><%=Html.Encode(ViewData.Model.DespatchAddress.PostCode)%></li>
</ul>

Items Ordered:
<ul>
    <% For Each Item As ACompany.OrderProcessing.Model.Item In ViewData.Model.Items%>
            
            <li><%=Item.Qty%> of <%=Item.Product.Name%> @ £<%=Item.Price%></li>
            
    <% Next%>
       
</ul>

<%  If ViewData.Model.CanProcess Then%>
<%=Html.ActionLink("Process this order", "Process", New With {.id = ViewData.Model.Id.ToString})%>
<% End If%>

<%  If ViewData.Model.CanCancel Then%>
<%=Html.ActionLink("Cancel this order", "Cancel", New With {.id = ViewData.Model.Id.ToString})%>
<% End If%>

</asp:Content>
